package com.imcrl.piano.mvc.model
{
	import com.imcrl.piano.mvc.model.vo.NoetsDefVO;
	
	import flash.utils.Dictionary;

	public class MusicModel
	{
		
		public static var perfectScore:int = 200;
		public static var coolScore:int = 150;
		public static var goodScore:int = 100;
		public static var badScore:int = 50;
		public static var missScore:int = 0;
		
		/**
		 * 以多少时间偏差来定义级别; 
		 */		
		public static var perfectTime:int =  100;
		public static var coolTime:int = 150;
		public static var goodTime:int = 200;
		public static var badTime:int = 250;
		
		
		private var noetsList:Vector.<NoetsDefVO>;
		
		public var channels:Dictionary;
		
		public var bgSoundPath:String;
		
		/**
		 * 按键时间总长; 
		 */		
		protected var totalTime:int;
		public function MusicModel()
		{			
			noetsList=new Vector.<NoetsDefVO>();
			
			
			channels = new Dictionary()
			channels[83] = 1;
			channels[68] = 2;
			channels[70] = 3;
			channels[32] = 4;
			channels[74] = 5;
			channels[75] = 6;
			channels[76] = 7;
		}

		
		public function set cofing(cfg:String):void{
			noetsList.splice(0,noetsList.length);
			
			var parms:Array;
			
			var list:Array = cfg.split(";");
			var itemvo:NoetsDefVO;
			for each(var item:String in list){
				parms=item.split(" ");
				
				itemvo=new NoetsDefVO(parms[4],parms[2],parms[0],parms[1]);
				noetsList.push(itemvo);
			}
			
			totalTime=itemvo.start+itemvo.duration;
		}
		
		public function get data():Vector.<NoetsDefVO>{
			return noetsList;
		}
		
	}
}